Class sbktech.tools.hashjava.bytecode.Environment
All Packages Class Hierarchy This Package Previous Next Index
Class sbktech.tools.hashjava.bytecode.Environment
java.lang.Object
|
+----sbktech.tools.hashjava.bytecode.Environment
- public class Environment
- extends Object
This is the class used to start obfuscating bytecode.
It contains all the information needed to process a set of class files,
and is instantiated to start the obfuscation process.
To use this class, first implement the BytecodeFactory
and Statistics interfaces. These are interfaces
used to read or write bytecode (for BytecodeFactory)
and generate debugging information (for Statistics)
Next, implement an Obfuscator interface, used to
rename symbols defined in the bytecode streams.
Now create an instance of this class to start the process.
The high level sequence looks as follows
Environment env = new Environment(myBytecodeFactory,
myObfuscator,
myStatistics);
while (<there are more classes to add>)
{
env.addClass(<DataInput for the bytecode for class>);
}
env.obfuscate();
env.dump();
- Author:
- $Author: kbs $
- See Also:
- BytecodeFactory, Obfuscator, Statistics
-
DEBUG_CORRUPT
- Constant indicating if debug information should be altered in ways
that tries to break disassemblers/debuggers/decompilers
-
DEBUG_REMOVE
- Constant indicating if debug information should be removed.
-
DEBUG_RETAIN
- Constant indicating if original debug information should be retained.
-
Environment(BytecodeFactory, Obfuscator, Statistics)
- create a new environment to start off the whole process.
-
addClass(DataInput, boolean)
- Use this to start adding classes to the environment for obfuscation.
-
dump()
- Write out the contents of the current environment into a set of
classes.
-
obfuscate()
- Start the obfuscating process.
-
setLineNumberDebugging(int)
- Control how line number debugging information is written out.
-
setLocalVariableDebugging(int)
- Control how local variable table information is written out.
-
setSourceFileDebugging(int)
- Control how source file debugging information is written out.
DEBUG_REMOVE
public final static int DEBUG_REMOVE
- Constant indicating if debug information should be removed.
DEBUG_CORRUPT
public final static int DEBUG_CORRUPT
- Constant indicating if debug information should be altered in ways
that tries to break disassemblers/debuggers/decompilers
DEBUG_RETAIN
public final static int DEBUG_RETAIN
- Constant indicating if original debug information should be retained.
Environment
public Environment(BytecodeFactory bfactory,
Obfuscator obfuscator,
Statistics stats)
- create a new environment to start off the whole process.
- Parameters:
- bfactory - This is a class to let the environment
read and write Class streams when it is necessary
- obfuscator - This is the only way to actually alter the names
of symbols encountered in the process.
- stats - This is called at various points in the manipulation
to entertain the user.
addClass
public void addClass(DataInput in,
boolean resolveFully) throws IOException, BytecodeFormatException
- Use this to start adding classes to the environment for obfuscation.
The method will also add all the superclasses and interfaces
implemented by this class, reading them through the
BytecodeFactory interface. Adding a class twice causes no harm,
except to slow down the program a little.
- Parameters:
- in - DataInput that contains the definition of the bytecode
to be added.
- resolveFully - if true, this will also attempt to add any
classes referenced by this class, instead of
only the superclasses and interfaces implemented by
this class. Exceptions are classes in the java.*
package. These will never be resolved fully to save loading
time.
- Throws: IOException
- if the DataInput part of things fail
- Throws: BytecodeFormatException
- if the bytecode itself is hosed.
- See Also:
- BytecodeFactory
obfuscate
public void obfuscate()
- Start the obfuscating process. This should be called only after
all the classes that are involved have been
added to the Environment.
Is also hands off each class that was added to the environment to the
obfuscator.
- See Also:
- addClass, obfuscate
dump
public void dump() throws IOException
- Write out the contents of the current environment into a set of
classes.
setLineNumberDebugging
public void setLineNumberDebugging(int val)
- Control how line number debugging information is written out. The
default setting is DEBUG_REMOVE.
- Parameters:
- val - is one of DEBUG_REMOVE, DEBUG_CORRUPT or DEBUG_RETAIN
setLocalVariableDebugging
public void setLocalVariableDebugging(int val)
- Control how local variable table information is written out. The default
setting is DEBUG_REMOVE
- Parameters:
- val - is one of DEBUG_REMOVE, DEBUG_CORRUPT or DEBUG_RETAIN
setSourceFileDebugging
public void setSourceFileDebugging(int val)
- Control how source file debugging information is written out. The
default setting is DEBUG_REMOVE
- Parameters:
- val - is one of DEBUG_REMOVE, DEBUG_CORRUPT or DEBUG_RETAIN
All Packages Class Hierarchy This Package Previous Next Index